<?php
ob_start();
?>
<div id="reporte">
    <p align="right">Fecha de impresion: <?php echo date('d-m-Y H:i'); ?></p>
    <h3 style="text-align: center;">Conceptos Digitales</h3>
    <h4 style="text-align: center;">Reporte de ingreso a la aplicacion</h4>
    <table style="width: 100%;" class="tabla_reporte" border="1" cellpadding="0" cellspacing="0">
        <tr>
            <th style="width: 15%;" class="tabla_reporte">
                Usuario
            </th>
            <th style="width: 35%;" class="tabla_reporte">
                Nombre
            </th>
            <th style="width: 25%;" class="tabla_reporte">
                Entrada
            </th>
            <th style="width: 25%;" class="tabla_reporte">
                Salida
            </th>
        </tr>
        <?php
        foreach ($ingresos as $ingreso):
        ?>
            <tr>
                <td style="width: 15%;"><?php echo $ingreso['User']['username']; ?>&nbsp;</td>
                <td style="width: 35%;"><?php echo $ingreso['User']['nombre_completo']; ?>&nbsp;</td>
                <td style="width: 25%;"><?php echo date('d-m-Y h:i A', strtotime($ingreso['ControlIngreso']['hora_ingreso'])); ?>&nbsp;</td>
                <td style="width: 25%;"><?php
            if (empty($ingreso['ControlIngreso']['hora_salida'])) {
                echo "--";
            } else {
                echo date('d-m-Y h:i A', strtotime($ingreso['ControlIngreso']['hora_salida']));
            }
        ?>&nbsp;</td>
        </tr>
        <?php endforeach; ?>
        </table>

    </div>
<?php
            $content = ob_get_clean();
            echo $content;
//    echo $form->create('Reporte', array(
//    'url' => array_merge(array('action' => ''), $this->params['pass'],array('1'))));
            echo $form->create('Reporte', array(
                'url' => array_merge(array('action' => 'imprimir_reporte'), array('Reporte de Ingresos'))));
            echo $form->input('paramreporte', array('div' => false, 'type' => 'hidden'));
            echo $form->input('quien', array('div' => false, 'type' => 'hidden', 'value' => $this->here));
            echo "<br /><br /><br />";
            echo $form->submit('Guardar', array('div' => false, 'onclick' => 'llenar_reporte();'));
            echo $form->end();
            echo "<br /><hr /><br /><br />";
?>


<script type="text/javascript">
    /**
     * Comment
     */
    function llenar_reporte() {
        reporte = document.getElementById("reporte");
        paramreporte = document.getElementById("ReporteParamreporte");
        paramreporte.value = '<page backtop="25mm" backbottom="25mm" backleft="30mm" backright="30mm">'+reporte.innerHTML+'</page>';
        return true;
    }
</script>


